Skip to content

Conversation

@msk226
Copy link
Member

@msk226 msk226 commented Jul 10, 2025

#️⃣ 연관된 이슈


🔎 작업 내용

  • 스터디 검색 쿼리를 기존 like 기반 조회 메서드로 변경

📷 스크린샷 (선택)

작업한 결과물에 대한 간단한 스크린샷을 올려주세요.


💬리뷰 요구사항 (선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요.

Summary by CodeRabbit

  • Bug Fixes

    • Improved the accuracy of study search results when searching by keyword in study titles.
  • Tests

    • Updated tests to align with the improved study search functionality.

@msk226 msk226 self-assigned this Jul 10, 2025
@msk226 msk226 added the ♻️ refactor Code Refactoring label Jul 10, 2025
@msk226 msk226 linked an issue Jul 10, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Walkthrough

The internal logic of the findStudiesByKeyword method was updated to use a different repository method for searching studies by title. Corresponding changes were made in the related test to mock and verify the new repository method. No public interfaces or method signatures were altered.

Changes

File(s) Change Summary
src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java Switched repository call in findStudiesByKeyword from searchByTitle to findAllByTitleContaining.
src/test/java/com/example/spot/service/study/StudyQueryServiceTest.java Updated test to mock and verify findAllByTitleContaining instead of searchByTitle.

Poem

A search for studies, now refined,
With titles that the keyword finds.
The code was tweaked, the test aligned,
Repository methods redefined.
A hop, a skip, a bunny’s cheer—
The search is better, crystal clear! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@msk226 msk226 merged commit b769819 into develop Jul 10, 2025
1 of 2 checks passed
@msk226 msk226 deleted the SPOT-297/refactor branch July 10, 2025 14:28
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07b8a72 and de1f734.

📒 Files selected for processing (2)
  • src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java (1 hunks)
  • src/test/java/com/example/spot/service/study/StudyQueryServiceTest.java (3 hunks)
👮 Files not reviewed due to content moderation or server errors (2)
  • src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java
  • src/test/java/com/example/spot/service/study/StudyQueryServiceTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_test
🔇 Additional comments (5)
src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java (2)

678-678: LGTM! Clean refactor to Spring Data JPA method.

The change from searchByTitle to findAllByTitleContaining successfully implements the like-based query approach as intended. The Spring Data JPA naming convention will automatically generate the appropriate SQL LIKE query for partial title matching.


685-685: LGTM: Count method updated consistently.

The count method has been properly updated to countAllByTitleContaining which maintains consistency with the query method change and ensures accurate pagination.

src/test/java/com/example/spot/service/study/StudyQueryServiceTest.java (3)

1569-1569: LGTM! Test properly updated to match service refactor.

The test changes correctly update mocking and verification to use findAllByTitleContaining instead of searchByTitle. Both success and failure test scenarios are appropriately covered, ensuring the refactored search functionality remains well-tested.

Also applies to: 1592-1592, 1602-1602


1569-1570: LGTM: Test mocks updated consistently with service changes.

The test has been properly updated to mock and verify the new findAllByTitleContaining method instead of searchByTitle. The test logic and assertions remain unchanged, which is appropriate since only the underlying repository method changed while the business logic stays the same.

Also applies to: 1592-1592, 1602-1603


1569-1569: LGTM! Test mocks properly updated to match service implementation.

The test file has been correctly updated to mock and verify the new repository method findAllByTitleContaining instead of the old searchByTitle. This ensures the tests remain valid and continue to verify the expected behavior.

Also applies to: 1592-1592, 1602-1602

String keyword, StudySortBy sortBy) {
// 키워드로 스터디 조회
List<Study> studies = studyRepository.searchByTitle(keyword, sortBy, pageable);
List<Study> studies = studyRepository.findAllByTitleContaining(keyword, sortBy, pageable);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

LGTM: Consistent implementation of like-based search.

The change to findAllByTitleContaining properly implements the like-based query method as mentioned in the PR objectives. The Spring Data JPA naming convention correctly translates to a SQL LIKE '%keyword%' operation for more flexible title searching.

Let's verify that the old searchByTitle method is no longer referenced elsewhere in the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining references to the old searchByTitle method
# Expected: No occurrences of searchByTitle method calls

echo "Searching for any remaining references to searchByTitle method..."
rg "searchByTitle" --type java

Length of output: 516


🏁 Script executed:

#!/bin/bash
# Description: Check for any invocation sites of the old searchByTitle method
echo "Searching for any call sites to searchByTitle..."
rg "\.searchByTitle" -n --type java

Length of output: 144


Remove unused searchByTitle declarations

Our search confirms there are no remaining calls to searchByTitle, but its signatures still exist in the custom repository interface and implementation. These should be cleaned up to avoid dead code:

• src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
• src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java

Please remove the searchByTitle(...) method from both files.

🤖 Prompt for AI Agents
In src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
and
src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java,
remove the unused searchByTitle method declarations and implementations
respectively, as they are no longer called anywhere in the codebase. This
cleanup will eliminate dead code and improve maintainability.

💡 Verification agent

🧩 Analysis chain

LGTM! Improved method naming follows Spring Data JPA conventions.

The change from searchByTitle to findAllByTitleContaining provides better clarity about the method's functionality and follows Spring Data JPA query method naming conventions.

Verify that all references to the old searchByTitle method have been updated throughout the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining references to the old searchByTitle method
# Expected: No occurrences should be found

echo "Searching for old method name 'searchByTitle'..."
rg "searchByTitle" --type java

echo "Searching for new method name 'findAllByTitleContaining'..."
rg "findAllByTitleContaining" --type java

Length of output: 1803


Remove remaining searchByTitle methods in the custom repository

The search revealed that the old searchByTitle API still exists alongside the new findAllByTitleContaining in your QueryDSL-based repository. To complete the rename and avoid confusion, please remove or rename these leftover definitions:

• src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java

-    List<Study> searchByTitle(String keyword, StudySortBy sortBy, Pageable pageable);
+    // removed in favor of findAllByTitleContaining(...)

• src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java

-    public List<Study> searchByTitle(String keyword, StudySortBy sortBy, Pageable pageable) {
-        …implementation…
-    }
+    // implementation consolidated under findAllByTitleContaining(...)

After removing these, ensure any callers (if any) are updated to use findAllByTitleContaining.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java at
line 678, you are already using the new method findAllByTitleContaining. To
complete the transition, remove the old searchByTitle method definitions from
src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
and
src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java.
Also, verify that no other code calls searchByTitle; if found, update those
calls to use findAllByTitleContaining instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor Code Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 스터디 검색 API 관련 요구사항 반영

2 participants